Allow completion popups to be wider than the entry. (#131916, Ross Burton)
authorMatthias Clasen <mclasen@redhat.com>
Mon, 4 Apr 2005 05:15:32 +0000 (05:15 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 4 Apr 2005 05:15:32 +0000 (05:15 +0000)
2005-04-04  Matthias Clasen  <mclasen@redhat.com>

Allow completion popups to be wider than the entry. (#131916,
Ross Burton)

* gtk/gtkentrycompletion.[hc]: Add a boolean popup-set-width property.

* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
Don't force the popup to have the same width as the entry if
popup-set-width is FALSE.

* gtk/gtk.symbols: Add new functions.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
docs/reference/ChangeLog
docs/reference/gtk/gtk-sections.txt
gtk/gtk.symbols
gtk/gtkentrycompletion.c
gtk/gtkentrycompletion.h

index 05e369f8dbc175b3fb7ef8a431d582dfde9b462c..f49110102c0b5f0c7febf53194ae6a1ffaccdbc0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-04-04  Matthias Clasen  <mclasen@redhat.com>
+
+       Allow completion popups to be wider than the entry. (#131916, 
+       Ross Burton)
+       
+       * gtk/gtkentrycompletion.[hc]: Add a boolean popup-set-width property.
+
+       * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): 
+       Don't force the popup to have the same width as the entry if 
+       popup-set-width is FALSE.
+
+       * gtk/gtk.symbols: Add new functions.
+
 2005-04-04  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkactiongroup.c (gtk_action_group_add_action_with_accel): 
index 05e369f8dbc175b3fb7ef8a431d582dfde9b462c..f49110102c0b5f0c7febf53194ae6a1ffaccdbc0 100644 (file)
@@ -1,3 +1,16 @@
+2005-04-04  Matthias Clasen  <mclasen@redhat.com>
+
+       Allow completion popups to be wider than the entry. (#131916, 
+       Ross Burton)
+       
+       * gtk/gtkentrycompletion.[hc]: Add a boolean popup-set-width property.
+
+       * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): 
+       Don't force the popup to have the same width as the entry if 
+       popup-set-width is FALSE.
+
+       * gtk/gtk.symbols: Add new functions.
+
 2005-04-04  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkactiongroup.c (gtk_action_group_add_action_with_accel): 
index 05e369f8dbc175b3fb7ef8a431d582dfde9b462c..f49110102c0b5f0c7febf53194ae6a1ffaccdbc0 100644 (file)
@@ -1,3 +1,16 @@
+2005-04-04  Matthias Clasen  <mclasen@redhat.com>
+
+       Allow completion popups to be wider than the entry. (#131916, 
+       Ross Burton)
+       
+       * gtk/gtkentrycompletion.[hc]: Add a boolean popup-set-width property.
+
+       * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): 
+       Don't force the popup to have the same width as the entry if 
+       popup-set-width is FALSE.
+
+       * gtk/gtk.symbols: Add new functions.
+
 2005-04-04  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkactiongroup.c (gtk_action_group_add_action_with_accel): 
index d706a5b281f75cbdbaa9ec69e52fb4ac9c62ede6..0566aaf89092fed718dbcc1b1c03bbab7a2ab84e 100644 (file)
@@ -1,3 +1,7 @@
+2005-04-04  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtk-sections.txt: Add new functions.
+
 2005-04-01  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/tmpl/gtkselection.sgml: Move docs inline.
index 7d31817f9b109e2016c6652ed2b845ba2adf466a..26871b4c625e3225736256bca0d56402b424fc5d 100644 (file)
@@ -1119,6 +1119,8 @@ gtk_entry_completion_set_inline_completion
 gtk_entry_completion_get_inline_completion
 gtk_entry_completion_set_popup_completion
 gtk_entry_completion_get_popup_completion
+gtk_entry_completion_set_popup_set_width
+gtk_entry_completion_get_popup_set_width
 <SUBSECTION Standard>
 GTK_TYPE_ENTRY_COMPLETION
 GTK_ENTRY_COMPLETION
index 4bee95dd78b2ee084d665df4f137ae29b513cd38..02ccc6ecca7a4e9efebdeb7edb21a468677e82d5 100644 (file)
@@ -1104,6 +1104,7 @@ gtk_entry_completion_get_inline_completion
 gtk_entry_completion_get_minimum_key_length
 gtk_entry_completion_get_model
 gtk_entry_completion_get_popup_completion
+gtk_entry_completion_get_popup_set_width
 gtk_entry_completion_get_text_column
 gtk_entry_completion_get_type G_GNUC_CONST
 gtk_entry_completion_insert_action_markup
@@ -1115,6 +1116,7 @@ gtk_entry_completion_set_match_func
 gtk_entry_completion_set_minimum_key_length
 gtk_entry_completion_set_model
 gtk_entry_completion_set_popup_completion
+gtk_entry_completion_set_popup_set_width
 gtk_entry_completion_set_text_column
 #endif
 #endif
@@ -1652,12 +1654,15 @@ gtk_icon_theme_set_search_path_utf8
 #if IN_FILE(__GTK_ICON_VIEW_C__)
 gtk_icon_view_get_column_spacing
 gtk_icon_view_get_columns
+gtk_icon_view_set_cursor
+gtk_icon_view_get_cursor
 gtk_icon_view_get_item_width
 gtk_icon_view_get_margin
 gtk_icon_view_get_markup_column
 gtk_icon_view_get_model
 gtk_icon_view_get_orientation
 gtk_icon_view_get_path_at_pos
+gtk_icon_view_get_item_at_pos
 gtk_icon_view_get_pixbuf_column
 gtk_icon_view_get_row_spacing
 gtk_icon_view_get_selected_items
index dd06d71747817216fae388b01f67d6ea19b6af2c..403cf35c4d6e96e172ba013bf99374aecf52fd93 100644 (file)
@@ -58,7 +58,8 @@ enum
   PROP_MINIMUM_KEY_LENGTH,
   PROP_TEXT_COLUMN,
   PROP_INLINE_COMPLETION,
-  PROP_POPUP_COMPLETION
+  PROP_POPUP_COMPLETION,
+  PROP_POPUP_SET_WIDTH
 };
 
 #define GTK_ENTRY_COMPLETION_GET_PRIVATE(obj)(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionPrivate))
@@ -334,6 +335,22 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
                                                         TRUE,
                                                         GTK_PARAM_READWRITE));
 
+  /**
+   * GtkEntryCompletion:popup-set-width:
+   * 
+   * Determines whether the completions popup window will be
+   * resized to the width of the entry.
+   *
+   * Since: 2.8
+   */
+  g_object_class_install_property (object_class,
+                                  PROP_POPUP_SET_WIDTH,
+                                  g_param_spec_boolean ("popup-set-width",
+                                                        P_("Popup set width"),
+                                                        P_("If TRUE, the popup window will have the same size as the entry"),
+                                                        TRUE,
+                                                        GTK_PARAM_READWRITE));
+
   g_type_class_add_private (object_class, sizeof (GtkEntryCompletionPrivate));
 }
 
@@ -365,6 +382,7 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
   priv->has_completion = FALSE;
   priv->inline_completion = FALSE;
   priv->popup_completion = TRUE;
+  priv->popup_set_width = TRUE;
 
   /* completions */
   priv->filter_model = NULL;
@@ -494,6 +512,10 @@ gtk_entry_completion_set_property (GObject      *object,
        priv->popup_completion = g_value_get_boolean (value);
         break;
 
+      case PROP_POPUP_SET_WIDTH:
+       priv->popup_set_width = g_value_get_boolean (value);
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -531,6 +553,10 @@ gtk_entry_completion_get_property (GObject    *object,
         g_value_set_boolean (value, gtk_entry_completion_get_popup_completion (completion));
         break;
 
+      case PROP_POPUP_SET_WIDTH:
+        g_value_set_boolean (value, gtk_entry_completion_get_popup_set_width (completion));
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1293,7 +1319,12 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
                                                  GTK_WIDGET (completion->priv->entry)->window);
   gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
 
-  width = MIN (completion->priv->entry->allocation.width, monitor.width) - 2 * x_border;
+  if (completion->priv->popup_set_width)
+    width = MIN (completion->priv->entry->allocation.width, monitor.width) - 2 * x_border;
+  else
+    width = -1;
+
+  gtk_tree_view_columns_autosize (completion->priv->tree_view);
   gtk_widget_set_size_request (completion->priv->tree_view, width, items * height);
 
   /* default on no match */
@@ -1610,5 +1641,52 @@ gtk_entry_completion_get_popup_completion (GtkEntryCompletion *completion)
   return completion->priv->popup_completion;
 }
 
+/**
+ * gtk_entry_completion_set_popup_set_width:
+ * @completion: a #GtkEntryCompletion
+ * @popup_set_width: %TRUE to make the width of the popup the same as the entry
+ *
+ * Sets whether the completion popup window will be resized to be the same
+ * width as the entry.
+ *
+ * Since: 2.8
+ */
+void 
+gtk_entry_completion_set_popup_set_width (GtkEntryCompletion *completion,
+                                         gboolean            popup_set_width)
+{
+  g_return_if_fail (GTK_IS_ENTRY_COMPLETION (completion));
+  
+  popup_set_width = popup_set_width != FALSE;
+
+  if (completion->priv->popup_set_width != popup_set_width)
+    {
+      completion->priv->popup_set_width = popup_set_width;
+
+      g_object_notify (G_OBJECT (completion), "popup-set-width");
+    }
+}
+
+/**
+ * gtk_entry_completion_get_popup_set_width:
+ * @completion: a #GtkEntryCompletion
+ * 
+ * Returns whether the  completion popup window will be resized to the 
+ * width of the entry.
+ * 
+ * Return value: %TRUE if the popup window will be resized to the width of 
+ *   the entry
+ * 
+ * Since: 2.8
+ **/
+gboolean
+gtk_entry_completion_get_popup_set_width (GtkEntryCompletion *completion)
+{
+  g_return_val_if_fail (GTK_IS_ENTRY_COMPLETION (completion), TRUE);
+  
+  return completion->priv->popup_set_width;
+}
+
+
 #define __GTK_ENTRY_COMPLETION_C__
 #include "gtkaliasdef.c"
index f1e22ebcc7edc330a4146498097ada940545a710..24ce984d0d62b6c7ad17bf71745887805d8c6f49 100644 (file)
@@ -107,6 +107,10 @@ gboolean            gtk_entry_completion_get_inline_completion  (GtkEntryComplet
 void                gtk_entry_completion_set_popup_completion   (GtkEntryCompletion          *completion,
                                                                  gboolean popup_completion);
 gboolean            gtk_entry_completion_get_popup_completion   (GtkEntryCompletion          *completion);
+void                gtk_entry_completion_set_popup_set_width    (GtkEntryCompletion          *completion,
+                                                                 gboolean popup_set_width);
+gboolean            gtk_entry_completion_get_popup_set_width    (GtkEntryCompletion          *completion);
+
 
 /* convenience */
 void                gtk_entry_completion_set_text_column        (GtkEntryCompletion          *completion,